import request from '/@/utils/request';

/**
 *
 * 用户api接口集合
 * @method
 */
export function userApi() {
    return {
        getUserInfo: (id: number) => {
            return request({
                url: 'sysUser/info/' + id,
                method: 'get',
            });
        },
        getTableData: (data: object) => {
            return request({
                url: 'sysUser/page',
                method: 'post',
                data,
            });
        },
        addRecord: (user: object) => {
            return request({
                url: 'sysUser/add',
                method: 'post',
                data: user,
            });
        },
        updateRecord: (user: object) => {
            return request({
                url: 'sysUser/update',
                method: 'post',
                data: user,
            });
        },
        delRecord: (user: object) => {
            return request({
                url: 'sysUser/delete',
                method: 'post',
                data: user,
            });
        },
        resetPassword: (user: object) => {
            return request({
                url: 'sysUser/resetPassword',
                method: 'post',
                data: user,
            });
        },
        assignRoles: (user: object) => {
            return request({
                url: 'sysUser/assignRoles',
                method: 'post',
                data: user,
            });
        },
        userRoleList: (userId: number) => {
            return request({
                url: 'sysUser/getUserRoleList/' + userId,
                method: 'get',
            });
        },
        exportRecord: (data: object) => {
            return request({
                url: 'sysUser/export',
                method: 'download',
                data: data
            });
        }
    };
}
